// LemCoop
// Copyright (C) 2013  Oliver Naumann <bldrax@gmail.com>

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef LEMC_LEVEL_H
#define LEMC_LEVEL_H

#include "WindowsIncludes.h"
#include <allegro5\allegro.h>
#include <vector>

#include "entry.h"
#include "groundmask.h"

struct Player
{
	int number_of_lems;
};

/*
* The Level class contains all information needed in order to play a level: It's size, how it looks, the ground mask,
* and so on.
*/
class Level
{
private:
	// The graphics of the level.
	ALLEGRO_BITMAP* m_graphics;

	// The ground mask used for determining where the Lems can walk, dig, and so on.
	GroundMask* m_mask;

public:
	// The unique id of the level.
	int id;

	// The number of the level in the current category.
	int number;

	// The title of the level.
	std::string title;

	// The number of players for which the level is built.
	int player_number;

	// The number of Lems to save.
	int lems_to_save;

	// The number of Lems to come out.
	int number_of_lems;

	// The width of the level.
	int size_x;

	// The height of the level.
	int size_y;

	// The list of player information.
	std::vector<Player> player_info;

	std::vector<Entry*> entries;

	Level();
	~Level();

	void OpenEntries();
	void StartToRelease();

	char GetGroundMaskValue(int x, int y);

	void Update(float timing_factor);
	void Draw();

	ALLEGRO_BITMAP* graphics() { return m_graphics; }
	void set_graphics(ALLEGRO_BITMAP* graphics) { m_graphics = graphics; }
	void set_mask(GroundMask* mask) { m_mask = mask; }
};

#endif